<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="ch">

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="左右结构项目，属于大人员的社交工具">
<meta name="keywords" content="左右结构项目 社交 占座 ">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<title>校园网上订餐系统</title>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>$(function() {
	$(".meun-item").click(function() {
		$(".meun-item").removeClass("meun-item-active");
		$(this).addClass("meun-item-active");
		var itmeObj = $(".meun-item").find("img");
		itmeObj.each(function() {
			var items = $(this).attr("src");
			items = items.replace("_grey.png", ".png");
			items = items.replace(".png", "_grey.png")
			$(this).attr("src", items);
		});
		var attrObj = $(this).find("img").attr("src");;
		attrObj = attrObj.replace("_grey.png", ".png");
		$(this).find("img").attr("src", attrObj);
	});
	$("#topAD").click(function() {
		$("#topA").toggleClass(" glyphicon-triangle-right");
		$("#topA").toggleClass(" glyphicon-triangle-bottom");
	});
	$("#topBD").click(function() {
		$("#topB").toggleClass(" glyphicon-triangle-right");
		$("#topB").toggleClass(" glyphicon-triangle-bottom");
	});
	$("#topCD").click(function() {
		$("#topC").toggleClass(" glyphicon-triangle-right");
		$("#topC").toggleClass(" glyphicon-triangle-bottom");
	});
	$(".toggle-btn").click(function() {
		$("#leftMeun").toggleClass("show");
		$("#rightContent").toggleClass("pd0px");
	})
})
</script>

<!-- 引入layui.js文件 -->
<script src="js/layui.js" charset="utf-8"></script>
<!-- 引入layui.css文件 -->
<link rel="stylesheet" href="css/layui.css" media="all">
<!--1. Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">


<style type="text/css">
::-webkit-scrollbar {
	display: none
}

.table {
	table-layout: fixed;
	/*word-wrap: break-word;
	overflow: hidden;*/
}

td {
	width: 100%;
	word-break: keep-all;
	/* 不换行 */
	white-space: nowrap;
	/* 不换行 */
	/*overflow: hidden;*/
	overflow-x: scroll;
	/* 内容超出宽度时隐藏超出部分的内容 */
	/*text-overflow: ;*/
	/* 当对象内文本溢出时显示省略标记(...) ；需与overflow:hidden;一起使用。*/
}
</style>
<!--[if lt IE 9]>
  <script src="js/html5shiv.min.js"></script>
  <script src="js/respond.min.js"></script>
<![endif]-->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/common.css" />
<link rel="stylesheet" type="text/css" href="css/slide.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/flat-ui.min.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.nouislider.css">
</head>

<body>
	<div id="wrap">
		<!-- 左侧菜单栏目块 -->
		<div class="leftMeun" id="leftMeun">
			<div id="logoDiv">
				<p id="logoP">
					<img id="logo" src="images/logo3.jpg"><span>与食俱进</span>
				</p>
			</div>
			<div id="personInfor">
				<p id="userName">大洋</p>
				<p></p>
				<p>
					<a>退出登录</a>
				</p>
			</div>
			<div class="meun-title">餐品管理</div>
			<div class="meun-item meun-item-active" href="#product"
				aria-controls="shop" role="tab" data-toggle="tab">
				<img src="images/icon_source.png">餐品管理
			</div>
			<div class="meun-item" href="#users" aria-controls="users" role="tab"
				data-toggle="tab">
				<img src="images/icon_chara_grey.png">餐品类型管理
			</div>
			<div class="meun-title">订单管理</div>
			<div class="meun-item" href="#orders" aria-controls="orders"
				role="tab" data-toggle="tab">
				<img src="images/icon_house.png">订单管理
			</div>
			<div class="meun-item" href="#statistics" aria-controls="statistics"
				role="tab" data-toggle="tab">
				<img src="images/icon_source.png">营业额统计
			</div>
			<div class="meun-item" href="#comments" aria-controls="comments"
				role="tab" data-toggle="tab">
				<img src="images/icon_source.png">评价管理
			</div>
		</div>
		<!-- 右侧具体内容栏目 -->
		<div id="rightContent">
			<a class="toggle-btn" id="nimei"> <i
				class="glyphicon glyphicon-align-justify"></i>
			</a>
			<!-- Tab panes -->
			<div class="tab-content">
				<!-- 餐品管理模块 -->
				<div role="tabpanel" class="tab-pane active" id="shop">
					<div class="check-div form-inline">
						<div class="col-xs-8">
							<button class="btn btn-yellow btn-xs" data-toggle="modal"
								data-target="#addProduct">添加餐品</button>
						</div>
						<form class="col-xs-4" action="ProductServlet" method="post">
							<input type="text" class="form-control input-sm"
								placeholder="输入文字搜索" name="keywords" value="${keywords}"
								id="keywords"> <input type="hidden" class="form-control"
								name="op" value="queryByPage">
							<button class="btn btn-white btn-xs ">查 询</button>
						</form>
					</div>

					<div class="data-div">
						<table class="table table-striped">
							<tr>
								<td class="col-lg-1 col-md-1 col-sm-1 col-xs-1">类型编号</td>
								<td class="col-lg-1 col-md-1 col-sm-1 col-xs-1">商家编号</td>
								<td class="col-lg-1 col-md-1 col-sm-1 col-xs-1">餐品名称</td>
								<td class="col-lg-1 col-md-1 col-sm-1 col-xs-1">餐品价格</td>
								<td class="col-lg-1 col-md-1 col-sm-1 col-xs-1">餐品介绍</td>
								<td class="col-lg-1 col-md-1 col-sm-1 col-xs-1">餐品状态</td>
								<td class="col-lg-1 col-md-1 col-sm-1 col-xs-1">餐品数量</td>
								<td class="col-lg-1 col-md-1 col-sm-1 col-xs-1">上架日期</td>
								<td class="col-lg-1 col-md-1 col-sm-1 col-xs-1">是否畅销</td>
								<td class="col-lg-1 col-md-1 col-sm-1 col-xs-1">是否新品</td>
								<td class="col-lg-2 col-md-2 col-sm-2 col-xs-2">操作</td>
							</tr>

							<tbody>

								<!-- 如果属性范围内的pd为null，我们就跳转到ProductServlet去获取数据，然后再转发回来 -->
								<c:if test="${pd==null}">

									<!-- c:redirect url="ProductServlet" 跳转到ProductServlet -->
									<c:redirect url="ProductServlet?op=queryByPage"></c:redirect>
								</c:if>


								<c:if test="${pd!=null}">
									<c:forEach items="${pd.data}" var="product">
										<tr>
                                            
                                           <!--  <input type="hidden" name="productid" value="productid"> -->
                                          
											<td>${product.typeid}</td>
											<td>${product.shopid}</td>
											<td>${product.productname}</td>
											<td>${product.productprice}</td>
											<td>${product.productintro}</td>
											<td>${product.productstate eq true?"在售":"售罄"}</td>
											<td>${product.prodcuctnum}</td>
											<td>${product.prodcuctdate}</td>
											<td>${product.changxiao eq true?"是":"否"}</td>
											<td>${product.xinpin eq true?"是":"否"}</td>
											
											<!--  -->


											<td>
												<button class="btn btn-success btn-xs updateproduct" data-toggle="modal"
													data-target="#changeProduct">修改</button>
												<button class="btn btn-danger btn-xs delType1" data-toggle="modal"
													data-target="#deleteProduct" >删除</button>
											</td>

										</tr>
									</c:forEach>
								</c:if>
							</tbody>
						</table>

					</div>

					<!-- 显示 分页导航区域 -->
					<div id="pagediv" style="text-align: center"></div>

					<!--弹出窗口 添加资源-->
					<div class="modal fade" id="addProduct" role="dialog"
						aria-labelledby="gridSystemModalLabel">
						<div class="modal-dialog" role="document">
							<div class="modal-content">
								<div class="modal-header">
									<button type="button" id="addProduct" class="close"
										data-dismiss="modal" aria-label="Close">
										<span aria-hidden="true">&times;</span>
									</button>
									<h4 class="modal-title" id="gridSystemModalLabel">添加餐品</h4>
								</div>
								<div class="modal-body">
									<div class="container-fluid">

										<%=request.getAttribute("msg") == null ? "" : request.getAttribute("msg")%>
										<!-- 前端的校验 -->

										<form class="form-horizontal" role="form"
											action="ProductServlet" method="post"
											onsubmit="return check()" enctype="multipart/form-data">
											<div class="form-group ">
												<label for="sName" class="col-xs-3 control-label">类型编号：</label>
												<div class="col-xs-8 ">
													<select type="text" class="form-control input-sm duiqi"
														id="typeid" placeholder="" name="typeid"></select>
												</div>
											</div>

											<div class="form-group ">
												<label for="sName" class="col-xs-3 control-label">商家编号：</label>
												<div class="col-xs-8 ">
													<input type="text" class="form-control input-sm duiqi"
														id="shopid" placeholder="" name="shopid">
												</div>
											</div>
											<div class="form-group ">
												<label for="sName" class="col-xs-3 control-label">餐品名称：</label>
												<div class="col-xs-8 ">
													<input type="text" class="form-control input-sm duiqi"
														id="productname" placeholder="" name="productname">
													<span id="msg"></span>
												</div>
											</div>
											<div class="form-group ">
												<label for="sName" class="col-xs-3 control-label">餐品价格：</label>
												<div class="col-xs-8 ">
													<input type="text" class="form-control input-sm duiqi"
														id="productprice" placeholder="" name="productprice">
												</div>
											</div>
											<div class="form-group ">
												<label for="sName" class="col-xs-3 control-label">餐品介绍：</label>
												<div class="col-xs-8 ">
													<input type="text" class="form-control input-sm duiqi"
														id="productintro" placeholder="" name="productintro">
												</div>
											</div>
											<div class="form-group ">
												<label for="sName" class="col-xs-3 control-label">餐品状态：</label>
												<div class="col-xs-8">
													<label class="control-label" for="anniu"> <input
														type="radio" name="productstate" id="productstate" value="是">是
													</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <label
														class="control-label" for="meun"> <input
														type="radio" name="productstate" id="productstate" value="否"> 否
													</label>
												</div>
											</div>
											<div class="form-group">
												<label for="sLink" class="col-xs-3 control-label">餐品数量：</label>
												<div class="col-xs-8 ">
													<input type="text" class="form-control input-sm duiqi"
														id="prodcuctnum" placeholder="" name="prodcuctnum">
												</div>
											</div>
											<div class="form-group">
												<label for="sOrd" class="col-xs-3 control-label">上架时间：</label>
												<div class="col-xs-8">
													<input type="date" class="form-control input-sm duiqi"
														id="prodcuctdate" placeholder="" name="prodcuctdate">
												</div>
											</div>

											<div class="form-group">
												<label for="exampleInput1" class="col-xs-3 control-label">餐品图片：</label>
												<div class="col-xs-8">
													<input type="file" name="headimg" id="headimg"></br>
												</div>
											</div>

											<div class="form-group">
												<label for="exampleInput1" class="col-xs-3 control-label">是否畅销：</label>
												<div class="col-xs-8">
													<label class="control-label" for="anniu"> <input
														type="radio" name="changxiao" id="changxiao" value="是">是
													</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <label
														class="control-label" for="meun"> <input
														type="radio" name="changxiao" id="changxiao" value="否"> 否
													</label>
												</div>
											</div>
											<div class="form-group">
												<label for="exampleInput1" class="col-xs-3 control-label">是否新品：</label>
												<div class="col-xs-8">
													<label class="control-label" for="anniu"> <input
														type="radio" name="xinpin" id="xinpin" value="是">是
													</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <label
														class="control-label" for="meun"> <input
														type="radio" name="xinpin" id="xinpin" value="否"> 否
													</label>
												</div>
											</div>
											<input type="hidden" name="op" value="add">

											<div class="modal-footer">
												<button type="button" class="btn btn-xs btn-xs btn-white"
													data-dismiss="modal">取 消</button>

												<input type="submit" class="btn btn-xs btn-xs btn-green"
													value="提交">

											</div>

										</form>
									</div>
								</div>

							</div>
							<!-- /.modal-content -->
						</div>
						<!-- /.modal-dialog -->
					</div>
					<!-- /.modal -->

					<!--修改资源弹出窗口-->
					<div class="modal fade" id="changeProduct" role="dialog"
						aria-labelledby="gridSystemModalLabel">
						<div class="modal-dialog" role="document">
							<div class="modal-content">
								<div class="modal-header">
									<button type="button" class="close" data-dismiss="modal"
										aria-label="Close">
										<span aria-hidden="true">&times;</span>
									</button>
									<h4 class="modal-title" id="gridSystemModalLabel">修改餐品</h4>
								</div>
								<div class="modal-body">
									<div class="container-fluid">
									<%=request.getAttribute("msg") == null ? "" : request.getAttribute("msg")%>
										<form class="form-horizontal" action="ProductServlet?op=update" method="post" enctype="multipart/form-data">
											<div class="form-group ">
												<label for="sName" class="col-xs-3 control-label">类型编号：</label>
												<div class="col-xs-8 ">
													<input type="text" class="form-control input-sm duiqi"
														id="updatetypeid" placeholder="" name="updatetypeid" readonly="readonly">
												</div>
											</div>

											<div class="form-group ">
												<label for="sName" class="col-xs-3 control-label">商家编号：</label>
												<div class="col-xs-8 ">
													<input type="text" class="form-control input-sm duiqi"
														id="updateshopid" placeholder="" name="updateshopid">
												</div>
											</div>
											<div class="form-group ">
												<label for="sName" class="col-xs-3 control-label">餐品名称：</label>
												<div class="col-xs-8 ">
													<input type="text" class="form-control input-sm duiqi"
														id="updateproductname" placeholder="" name="updateproductname" readonly="readonly">
													<span id="msg"></span>
												</div>
											</div>
											<div class="form-group ">
												<label for="sName" class="col-xs-3 control-label">餐品价格：</label>
												<div class="col-xs-8 ">
													<input type="text" class="form-control input-sm duiqi"
														id="updateproductprice" placeholder="" name="updateproductprice">
												</div>
											</div>
											<div class="form-group ">
												<label for="sName" class="col-xs-3 control-label">餐品介绍：</label>
												<div class="col-xs-8 ">
													<input type="text" class="form-control input-sm duiqi"
														id="updateproductintro" placeholder="" name="updateproductintro">
												</div>
											</div>
											<div class="form-group ">
												<label for="sName" class="col-xs-3 control-label">餐品状态：</label>
												<div class="col-xs-8">
													<label class="control-label" for="anniu"> <input
														type="radio" name="updateproductstate" id="updateproductstate" value="是">是
													</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <label
														class="control-label" for="meun"> <input
														type="radio" name="updateproductstate" id="updateproductstate" value="否"> 否
													</label>
												</div>
											</div>
											<div class="form-group">
												<label for="sLink" class="col-xs-3 control-label">餐品数量：</label>
												<div class="col-xs-8 ">
													<input type="text" class="form-control input-sm duiqi"
														id="updateprodcuctnum" placeholder="" name="updateprodcuctnum">
												</div>
											</div>
											<div class="form-group">
												<label for="sOrd" class="col-xs-3 control-label">上架时间：</label>
												<div class="col-xs-8">
													<input type="date" class="form-control input-sm duiqi"
														id="updateprodcuctdate" placeholder="" name="updateprodcuctdate">
												</div>
											</div>

											<div class="form-group">
												<label for="exampleInput1" class="col-xs-3 control-label">餐品图片：</label>
												<div class="col-xs-8">
													<input type="file" name="headimg" id="headimg"></br>
												</div>
											</div>

											<div class="form-group">
												<label for="exampleInput1" class="col-xs-3 control-label">是否畅销：</label>
												<div class="col-xs-8">
													<label class="control-label" for="anniu"> <input
														type="radio" name="updatechangxiao" id="updatechangxiao" value="是">是
													</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <label
														class="control-label" for="meun"> <input
														type="radio" name="updatechangxiao" id="updatechangxiao" value="否"> 否
													</label>
												</div>
											</div>
											<div class="form-group">
												<label for="exampleInput1" class="col-xs-3 control-label">是否新品：</label>
												<div class="col-xs-8">
													<label class="control-label" for="anniu"> <input
														type="radio" name="updatexinpin" id="updatexinpin" value="是">是
													</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <label
														class="control-label" for="meun"> <input
														type="radio" name="updatexinpin" id="updatexinpin" value="否"> 否
													</label>
												</div>
											</div>
											<input type="hidden" name="op" value="update">

											<div class="modal-footer">
												<button type="button" class="btn btn-xs btn-xs btn-white"
													data-dismiss="modal">取 消</button>

												<input type="submit" class="btn btn-xs btn-xs btn-green"
													value="提交">

											</div>

										</form>
									</div>
								</div>
							</div>
							<!-- /.modal-content -->
						</div>
						<!-- /.modal-dialog -->
					</div>
					<!-- /.modal -->
					<!--弹出删除资源警告窗口-->
					<div class="modal fade" id="deleteProduct" role="dialog"
						aria-labelledby="gridSystemModalLabel">
						<div class="modal-dialog" role="document">
							<div class="modal-content">
								<div class="modal-header">
									<button type="button" class="close" data-dismiss="modal"
										aria-label="Close">
										<span aria-hidden="true">&times;</span>
									</button>
									<h4 class="modal-title" id="gridSystemModalLabel">提示</h4>
								</div>
								<div class="modal-body">
									<div class="container-fluid">确定要删除该资源？删除后不可恢复！</div>
								</div>
								<div class="modal-footer">
									<button type="button" class="btn btn-xs btn-white"
										data-dismiss="modal">取 消</button>
									<button type="button" class="btn btn-xs btn-danger delType">保
										存</button>
								</div>
							</div>
							
						</div>
						
					</div>
					
				
				
				<!-- 引入layui.js文件 -->
				<script src="layui/layui.js" charset="utf-8"></script>
				
				<%-- <script src="${pageContext.request.contextPath}/layui/layui.js" charset="utf-8"></script> --%>


				<script src="js/jquery.nouislider.js"></script>

				<!-- this page specific inline scripts -->
				<script>				
function huadong(my, unit, def, max) {
	$(my).noUiSlider({
		range: [0, max],
		start: [def],
		handles: 1,
		connect: 'upper',
		slide: function() {
			var val = Math.floor($(this).val());
			$(this).find(".noUi-handle").text(
				val + unit
			);
			console.log($(this).find(".noUi-handle").parent().parent().html());
		},
		set: function() {
			var val = Math.floor($(this).val());
			$(this).find(".noUi-handle").text(
				val + unit
			);
		}
	});
	$(my).val(def, true);
}
huadong('.slider-minmax1', "分钟", "5", 30);
huadong('.slider-minmax2', "分钟", "6", 15);
huadong('.slider-minmax3', "分钟", "10", 60);
huadong('.slider-minmax4', "次", "2", 10);
huadong('.slider-minmax5', "天", "3", 7);
huadong('.slider-minmax6', "天", "8", 10);</script>


				<script>
layui.use(['laypage', 'layer'], function(){
  var laypage = layui.laypage
  ,layer = layui.layer;
  
//完整功能
  laypage.render({
    elem: 'pagediv'//分页的导航在哪里显示，pagediv是层id
    ,theme:'#7D9EC0'//颜色
    ,count: ${pd.totalCount}//总记录数
    ,curr: ${pd.page}//当前页
    ,limit: ${pd.pageSize}//当前页显示的记录数
    ,layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
    ,jump: function(obj, first){//页面跳转时候的动作
	    //obj包含了当前分页的所有参数，比如：
	    console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
	    console.log(obj.limit); //得到每页显示的条数
	    
	    //首次不执行
	    //分页的时候也要把查询的关键字传到servlet
	    if(!first){
	      //do something
	       location.href="ProductServlet?op=queryByPage&page="+obj.curr+"&pageSize="+obj.limit+"&keywords="+$("#keywords").val();
	    }
	  }
  });
});
  
  
  
  /* 删除开始 */
  //设置全局变量
  var productname="";
  $(".delType1").click(function(){
	  productname = $(this).parents("tr").find("td").eq(2).text();
	  console.log("productname:"+productname);
  });
  
  //给删除超链接设置了类class,作用希望我们可以定位a标签，同时完成其单击事件
  $(".delType").click(function(){  
	    $.ajax({	    	
	    	//参数
	    	url: "ProductServlet",
	    	type: "post",
	    	data:{
	    		productname: productname,
	    		op: "del"
	    	},
	    	success: function(res){
	    		//判断返回值的结果，根据结果做提示以及后续的页面刷新操作
	    		if(res.msg == "true")
	    			{
	    			console.log("删除成功")
	    				  //页面刷新
	    			location.href="ProductServlet?op=queryByPage&page="+${pd.page}+"&pageSize="+${pd.pageSize}+"&keywords="+$("#keywords").val();	    				  
	    			 	    					    			
	    			}
	    		else{
	    			    console.log("删除失败")
	    			    layer.msg('删除失败!', {
	    				icon: 1,
	    			    time: 2000, //2s后自动关闭
	    			    btn: ['确定']
	    			  });
	    			
	    		}
	    		
	    	},
	    	dataType: "json"	    		    	
	    	
	  });		  	    

}); 
</script>
<!-- 删除结束 -->



<!-- 判断餐品名称是否重复 -->
		 <script>
	  //标记一下ajaxName函数是否有执行
		var msg = "";

		$(function() {
            //文本框事件 ： 失去焦点
			$("#productname").blur(function() {
				//1验证用户是否输入的空格

				if ($("#productname").val() == ""
						|| $("#productname").val().indexOf(" ") > 0) {

				} else {
					//2保证没有输入空格情况下，再调用ajaxName
					ajaxName();
				}
			});
		});

		function ajaxName() {

			$.ajax({
				//key:value
				url : "ProductServlet",
				type : "get",
				data : {
					productname : $("#productname").val(),
					//传参数
					op : "ajaxproductname"
				},
				success : function(data) {
					console.log("data->msg: " + data);
					msg = data;
					//其实在前端有一些必要判断
					if (msg == "notexists") {
						//这个内容是在前端自定义的，也给前端人员一些自由
						$("#msg").html("可以使用!");
					} else {
						$("#msg").html("重复了，换一个!");
					}
					//$("#msg")得到页面上id为msg的那个span

				},
				dataType : "json"

			});

		}

		function check() {
			//点击增加按钮的时候，都要判断是否有重复的内容(类型重复)
			//1 重复校验和判断
		
			if (msg == "notexists") {
				return true;//表单要提交
			} else {
				return false;//2表单不提交
			}

		}
	</script>
	<!-- 判断餐品名称是否重复结束 -->




				<script>
	$(function() {

		//得到一个对象，或者多个对象，将对象显示层中
		$.get("ProductTypeServlet?op=ajaxrequest", function(data) {
			// console.log(data);
			//遍历 jQuery
			$.each(data,
					function(index, nt) {
						console.log(index+","+nt.typeid+","+nt.typename);
						$("#typeid").append(
								"<option value="+nt.typeid+">" + nt.typename
										+ "</option>");
					});
		});
	});
</script>


<!-- 修改开始 -->
<script>

var typeid =0;
var shopid =0;
var productname =null;
var productprice = 0;
var productintro =null;
var productstate =true;
var prodcuctnum =0;
var prodcuctdate =null;
var prodcuctimg =null;
var changxiao =true;
var xinpin =true;

$(".updateproduct").click(function(){
	//获取到id
	typeid = $(this).parents("tr").find("td").eq(0).text();
	shopid = $(this).parents("tr").find("td").eq(1).text();
	productname = $(this).parents("tr").find("td").eq(2).text();
	productprice = $(this).parents("tr").find("td").eq(3).text();
	productintro = $(this).parents("tr").find("td").eq(4).text();
	productstate = $(this).parents("tr").find("td").eq(5).text();
	prodcuctnum = $(this).parents("tr").find("td").eq(6).text();
	prodcuctdate = $(this).parents("tr").find("td").eq(7).text();
	prodcuctimg = $(this).parents("tr").find("td").eq(8).text();
	changxiao = $(this).parents("tr").find("td").eq(9).text();
	xinpin = $(this).parents("tr").find("td").eq(10).text();
	
	//把获取到的值放到对应的框中
	$("#updatetypeid").val(typeid);
	$("#updateshopid").val(shopid);
	$("#updateproductname").val(productname);
	$("#updateproductprice").val(productprice);
	$("#updateproductintro").val(productintro);
	$("#updateproductstate").val(productstate);
	$("#updateprodcuctnum").val(prodcuctnum);
	$("#updateprodcuctdate").val(prodcuctdate);
	$("#updateprodcuctimg").val(prodcuctimg);
	$("#updatechangxiao").val(changxiao);
	$("#updatexinpin").val(xinpin);
	
});



</script>

<!-- 修改结束 -->


</body>
</html>